package com.student.controller;

import com.student.dto.ResponseDto;
import com.student.pojo.ArtistSchedules;
import com.student.service.ArtistSchedulesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: SupportGroup
 * @BelongsPackage: com.student.controller
 * @Author: 小徐
 * @CreateTime: 2025-02-28 15:43
 * @Description: TODO
 * @Version: 1.0
 */
@RestController
@RequestMapping("ArtistSchedules")
public class ArtistSchedulesContorller {
    @Autowired
    private ArtistSchedulesService artistSchedulesService;

    /**
     * 获取行程所有信息
     *
     * @param artistSchedules
     * @return
     */
    @RequestMapping("getAllArtistSchedules")
    public ResponseDto getAllArtistSchedules(@RequestBody ArtistSchedules artistSchedules) {
        return artistSchedulesService.getAllArtistSchedules(artistSchedules);
    }

    /**
     * 添加行程信息
     *
     * @param artistSchedules
     * @return
     */
    @RequestMapping("addArtistSchedules")
    public ResponseDto addArtistSchedules(@RequestBody ArtistSchedules artistSchedules) {
        System.err.println(artistSchedules);
        return artistSchedulesService.addArtistSchedules(artistSchedules);
    }

    @RequestMapping("updateArtistSchedules")
    public ResponseDto updateArtistSchedules(@RequestBody ArtistSchedules artistSchedules) {
        System.err.println(artistSchedules);
        return artistSchedulesService.updateArtistSchedules(artistSchedules);
    }

    /**
     * 用户前端页面的艺人展示
     * @param artistSchedules
     * @return
     */
    @RequestMapping("getAllArtistSchedulesPerson")
    public ResponseDto getAllArtistSchedulesPerson(@RequestBody ArtistSchedules artistSchedules) {
        System.err.println(artistSchedules);
        return artistSchedulesService.getAllArtistSchedulesPerson(artistSchedules);
    }

    /**
     * 这边获取单个行程信息
     * @param id
     * @return
     */
    @RequestMapping("SingleArtistSchedules")
    public ResponseDto getSingleArtistSchedules(@RequestParam("id") Integer id) {
        return artistSchedulesService.SingleArtistSchedules(id);
    }

    @RequestMapping("toggleLike")
    public ResponseDto toggleLike(@RequestParam("id") Integer id,@RequestParam("likesCount") Integer likesCount,@RequestParam("artistId") Integer artistId) {
        return artistSchedulesService.toggleLike(id,likesCount,artistId);
    }
}